package org.javaboy.validation_demo.model;

import jakarta.validation.constraints.*;
import org.javaboy.validation_demo.validation.CreateGroup;
import org.javaboy.validation_demo.validation.EditGroup;

import java.util.Date;

public class User {
    @NotNull(message = "{user.id.notnull}",groups = EditGroup.class)
    private Integer id;
    @Max(value = 150,message = "{user.age.max}",groups = {EditGroup.class, CreateGroup.class})
    @Min(value = 18,message = "{user.age.min}",groups = {EditGroup.class, CreateGroup.class})
    @NotNull(message = "{user.age.notnull}",groups = {EditGroup.class, CreateGroup.class})
    private Integer age;
    @Email(message = "{user.email.email}",groups = {EditGroup.class, CreateGroup.class})
    @NotBlank(message = "{user.email.notblank}",groups = {EditGroup.class, CreateGroup.class})
    private String email;
    @Past(groups = {EditGroup.class, CreateGroup.class})
    @NotNull(groups = {EditGroup.class, CreateGroup.class})
    private Date birthday;

    @NotBlank(groups = {EditGroup.class, CreateGroup.class})
    @Size(min = 6,max = 15,groups = {EditGroup.class, CreateGroup.class})
    private String username;


    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", age=" + age +
                ", email='" + email + '\'' +
                ", birthday=" + birthday +
                ", username='" + username + '\'' +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
}
